﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Data;
using System.Data.Common;

namespace QLHPHP
{
    public static class TimKiem
    {
        /// <summary>
        /// Tim kiem theo họ tên sinh vien trong danh sách sinh viên
        /// </summary>
        public static DataTable TimKiemHoTenTrongDS(string HoTen)
        {
            DbCommand comm = DataAccess.CreateCommand();
            comm.CommandText = "TimKiemTenSVTrongDS";

            DbParameter param = comm.CreateParameter();
            param.ParameterName = "@HoTen";
            param.DbType = DbType.String;
            param.Value = HoTen;
            comm.Parameters.Add(param);

            return DataAccess.ExecuteSelectCommand(comm);
        }

        /// <summary>
        /// Tim kiem theo họ tên sinh vien trong danh sách sinh viên chưa đóng học phi
        /// </summary>
        public static DataTable TimKiemSinhVienTrongDSChuaDongHP(string HoTen)
        {
            DbCommand comm = DataAccess.CreateCommand();
            comm.CommandText = "TimKiemSvTrongDSChuaDongHocPhi";

            DbParameter param = comm.CreateParameter();
            param.ParameterName = "@HoTen";
            param.DbType = DbType.String;
            param.Value = HoTen;
            comm.Parameters.Add(param);

            return DataAccess.ExecuteSelectCommand(comm);
        }

        /// <summary>
        /// Tim kiem theo họ tên sinh vien
        /// </summary>
        public static DataTable TimKiemTheoHoTen(string HoTen)
        {
            DbCommand comm = DataAccess.CreateCommand();
            comm.CommandText = "TimKiemTheoHoTen";

            DbParameter param = comm.CreateParameter();
            param.ParameterName = "@HoTen";
            param.DbType = DbType.String;
            param.Value = HoTen;
            comm.Parameters.Add(param);

            return DataAccess.ExecuteSelectCommand(comm);
        }

        /// <summary>
        /// Tim kiem theo MSSV
        /// </summary>
        public static DataTable TimKiemTheoMSSV(string MSSV)
        {
            DbCommand comm = DataAccess.CreateCommand();
            comm.CommandText = "TimKiemTheoMSSV";

            DbParameter param = comm.CreateParameter();
            param.ParameterName = "@MSSV";
            param.DbType = DbType.String;
            param.Value = MSSV;
            comm.Parameters.Add(param);

            return DataAccess.ExecuteSelectCommand(comm);
        }

        /// <summary>
        /// Tim kiem theo GioiTinh
        /// </summary>
        public static DataTable TimKiemTheoGioiTinh(string GioiTinh)
        {
            DbCommand comm = DataAccess.CreateCommand();
            comm.CommandText = "TimKiemTheoGioiTinh";

            DbParameter param = comm.CreateParameter();
            param.ParameterName = "@GioiTinh";
            param.DbType = DbType.String;
            param.Value = GioiTinh;
            comm.Parameters.Add(param);

            return DataAccess.ExecuteSelectCommand(comm);
        }

        /// <summary>
        /// Tim kiem theo ten huyen
        /// </summary>
        public static DataTable TimKiemTheoTenHuyen(string TenHuyen)
        {
            DbCommand comm = DataAccess.CreateCommand();
            comm.CommandText = "TimKiemTheoTenHuyen";

            DbParameter param = comm.CreateParameter();
            param.ParameterName = "@TenHuyen";
            param.DbType = DbType.String;
            param.Value = TenHuyen;
            comm.Parameters.Add(param);

            return DataAccess.ExecuteSelectCommand(comm);
        }

        /// <summary>
        /// Tim kiem theo ten nganh
        /// </summary>
        public static DataTable TimKiemTheoTenNganh(string TenNganh)
        {
            DbCommand comm = DataAccess.CreateCommand();
            comm.CommandText = "TimKiemTheoTenNganh";

            DbParameter param = comm.CreateParameter();
            param.ParameterName = "@TenNganh";
            param.DbType = DbType.String;
            param.Value = TenNganh;
            comm.Parameters.Add(param);

            return DataAccess.ExecuteSelectCommand(comm);
        }

        /// <summary>
        /// Tim kiem theo ten khoa
        /// </summary>
        public static DataTable TimKiemTheoTenKhoa(string TenKhoa)
        {
            DbCommand comm = DataAccess.CreateCommand();
            comm.CommandText = "TimKiemTheoTenKhoa";

            DbParameter param = comm.CreateParameter();
            param.ParameterName = "@TenKhoa";
            param.DbType = DbType.String;
            param.Value = TenKhoa;
            comm.Parameters.Add(param);

            return DataAccess.ExecuteSelectCommand(comm);
        }

        /// <summary>
        /// Tim kiem theo ma doi tuong
        /// </summary>
        public static DataTable TimKiemTheoMaDoiTuong(string MaDoiTuong)
        {
            DbCommand comm = DataAccess.CreateCommand();
            comm.CommandText = "TimKiemTheoMaDoiTuong";

            DbParameter param = comm.CreateParameter();
            param.ParameterName = "@MaDoiTuong";
            param.DbType = DbType.String;
            param.Value = MaDoiTuong;
            comm.Parameters.Add(param);

            return DataAccess.ExecuteSelectCommand(comm);
        }

        /// <summary>
        /// Tim kiem theo so dien thoai
        /// </summary>
        public static DataTable TimKiemTheoSoDT(string SoDT)
        {
            DbCommand comm = DataAccess.CreateCommand();
            comm.CommandText = "TimKiemTheoSoDT";

            DbParameter param = comm.CreateParameter();
            param.ParameterName = "@SoDT";
            param.DbType = DbType.String;
            param.Value = SoDT;
            comm.Parameters.Add(param);

            return DataAccess.ExecuteSelectCommand(comm);
        }

        /// <summary>
        /// Tim kiem theo dia chi
        /// </summary>
        public static DataTable TimKiemTheoDiaChi(string DiaChi)
        {
            DbCommand comm = DataAccess.CreateCommand();
            comm.CommandText = "TimKiemTheoDiaChi";

            DbParameter param = comm.CreateParameter();
            param.ParameterName = "@DiaChi";
            param.DbType = DbType.String;
            param.Value = DiaChi;
            comm.Parameters.Add(param);

            return DataAccess.ExecuteSelectCommand(comm);
        }

        /// <summary>
        /// Tim kiem theo email
        /// </summary>
        public static DataTable TimKiemTheoEmail(string Email)
        {
            DbCommand comm = DataAccess.CreateCommand();
            comm.CommandText = "TimKiemTheoEmail";

            DbParameter param = comm.CreateParameter();
            param.ParameterName = "@Email";
            param.DbType = DbType.String;
            param.Value = Email;
            comm.Parameters.Add(param);

            return DataAccess.ExecuteSelectCommand(comm);
        }

        /// <summary>
        /// Tim kiem nang cao
        /// </summary>
        public static DataTable TimKiemNangCao(string MSSV, string HoTen, string GioiTinh, string TenHuyen, string TenNganh,
            string TenKhoa, string MaDoiTuong,string DiaChi)
        {
            DbCommand comm = DataAccess.CreateCommand();
            comm.CommandText = "TimKiemNangCao";

            DbParameter param = comm.CreateParameter();
            param.ParameterName = "@MSSV";
            param.DbType = DbType.String;
            param.Value = MSSV;
            comm.Parameters.Add(param);

            param = comm.CreateParameter();
            param.ParameterName = "@HoTen";
            param.DbType = DbType.String;
            param.Value = HoTen;
            comm.Parameters.Add(param);

            param = comm.CreateParameter();
            param.ParameterName = "@GioiTinh";
            param.DbType = DbType.String;
            param.Value = GioiTinh;
            comm.Parameters.Add(param);

            param = comm.CreateParameter();
            param.ParameterName = "@TenHuyen";
            param.DbType = DbType.String;
            param.Value = TenHuyen;
            comm.Parameters.Add(param);

            param = comm.CreateParameter();
            param.ParameterName = "@TenNganh";
            param.DbType = DbType.String;
            param.Value = TenNganh;
            comm.Parameters.Add(param);

            param = comm.CreateParameter();
            param.ParameterName = "@TenKhoa";
            param.DbType = DbType.String;
            param.Value = TenKhoa;
            comm.Parameters.Add(param);

            param = comm.CreateParameter();
            param.ParameterName = "@MaDoiTuong";
            param.DbType = DbType.String;
            param.Value = MaDoiTuong;
            comm.Parameters.Add(param);

            param = comm.CreateParameter();
            param.ParameterName = "@DiaChi";
            param.DbType = DbType.String;
            param.Value = DiaChi;
            comm.Parameters.Add(param);

            return DataAccess.ExecuteSelectCommand(comm);
        }

        /// <summary>
        /// Tim kiem ten mon hoc trong danh sach
        /// </summary>
        public static DataTable TimKiemMonHocTrongDS(string TenMonHoc)
        {
            DbCommand comm = DataAccess.CreateCommand();
            comm.CommandText = "TimKiemTenMonHocTrongDS";

            DbParameter param = comm.CreateParameter();
            param.ParameterName = "@TenMonHoc";
            param.DbType = DbType.String;
            param.Value = TenMonHoc;
            comm.Parameters.Add(param);

            return DataAccess.ExecuteSelectCommand(comm);
        }

    }
}
